package model

import "time"

const (
	RoleMember = 0
	RoleAdmin  = 1
)

type ProjectUser struct {
	ID        uint64    `gorm:"primaryKey"`
	ProjectID uint64    `gorm:"column:project_id;not null"`
	UserID    string    `gorm:"column:user_id;not null"`
	Role      int8      `gorm:"column:role;not null;default:0"`
	APIKey    string    `gorm:"column:api_key;not null;uniqueIndex"`
	CreatedAt time.Time `gorm:"column:created_at;not null;default:CURRENT_TIMESTAMP"`
	UpdatedAt time.Time `gorm:"column:updated_at;not null;default:CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP"`
}

func (ProjectUser) TableName() string {
	return "project_users"
}
